export const FETCH_ME_BEGIN = 'FETCH_ME_BEGIN';
export const FETCH_ME_SUCCESS = 'FETCH_ME_SUCCESS';
export const FETCH_ME_FAILED = 'FETCH_ME_FAILED';


export const fetchMe = () => ({type: FETCH_ME_BEGIN})

export const CREATE_USER_BEGIN = 'CREATE_USER_BEGIN';
export const CREATE_USER_SUCCESS = 'CREATE_USER_SUCCESS';
export const CREATE_USER_FAILED = 'CREATE_USER_FAILED';
export const createUser = (email, password) => ({type: CREATE_USER_BEGIN, payload: {email, password, user: email}});

export const CREATE_THREAD_BEGIN = 'CREATE_THREAD_BEGIN';
export const CREATE_THREAD_SUCCESS = 'CREATE_THREAD_SUCCESS';
export const CREATE_THREAD_FAILED = 'CREATE_THREAD_FAILED';
export const createThread = (title, content, tags = []) => ({type: CREATE_THREAD_BEGIN, payload: {title, content, tags}})

export const FETCH_THREAD_LIST_BEGIN = 'FETCH_THREAD_LIST_BEGIN';
export const FETCH_THREAD_LIST_SUCCESS = 'FETCH_THREAD_LIST_SUCCESS';
export const FETCH_THREAD_LIST_FAILED = 'FETCH_THREAD_LIST_FAILED';
export const fetchThreadList = f => ({type: FETCH_THREAD_LIST_BEGIN, payload: { q: f}})

export const FETCH_THREAD_BEGIN = 'FETCH_THREAD_BEGIN';
export const FETCH_THREAD_SUCCESS = 'FETCH_THREAD_SUCCESS';
export const FETCH_THREAD_FAILED = 'FETCH_THREAD_FAILED';
export const fetchThread = id => ({type: FETCH_THREAD_BEGIN, payload: {id}})

export const FETCH_COMMENTS_BEGIN = 'FETCH_COMMENTS_BEGIN';
export const FETCH_COMMENTS_SUCCESS = 'FETCH_COMMENTS_SUCCESS';
export const FETCH_COMMENTS_FAILED = 'FETCH_COMMENTS_FAILED';
export const fetchComments = id => ({type: FETCH_COMMENTS_BEGIN, payload: {id}})

export const CREATE_COMMENTS_BEGIN = 'CREATE_COMMENTS_BEGIN';
export const CREATE_COMMENTS_SUCCESS = 'CREATE_COMMENTS_SUCCESS';
export const CREATE_COMMENTS_FAILED = 'CREATE_COMMENTS_FAILED';
export const createComments = (id, content) => ({type: CREATE_COMMENTS_BEGIN, payload: {id, content}})


export const LOGIN_BEGIN = 'LOGIN_BEGIN';
export const LOGIN_SUCCESS = 'LOGIN_SUCCESS';
export const LOGIN_FAILED = 'LOGIN_FAILED';
export const login = (username, password) => ({type: LOGIN_BEGIN, payload: {username, password}})
